package layers

func ConvertTensor2to1(x [][]float64) []float64 {
	y := make([]float64, 0)
	for _, v := range x {
		y = append(y, v...)
	}
	return y
}

func ConvertTensor1to2(x []float64, outCount uint) [][]float64 {
	leng := len(x) / int(outCount)
	y := make([][]float64, 0)

	//log.Println("1to2:", leng, len(x), outCount)
	for i := 0; i < int(outCount); i++ {
		y = append(y, x[i*leng:(i+1)*leng])
	}
	//log.Println("1to2:", len(y)*len(y[0]))
	return y
}
